﻿#include "Quaternion.h"


namespace Base {


	Quaternion Quaternion::CreateFromRollPitchYaw(float rollRad, float pitchRad, float yawRad) {
		// ZXY 顺序
		Quaternion qx(sinf(pitchRad * 0.5f), 0, 0, cosf(pitchRad * 0.5f));
		Quaternion qy(0, sinf(yawRad * 0.5f), 0, cosf(yawRad * 0.5f));
		Quaternion qz(0, 0, sinf(rollRad * 0.5f), cosf(rollRad * 0.5f));
		return qy * qx * qz;
	}
}